<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tk="http://www.qdocuments.net" exclude-result-prefixes="tk">
  <xsl:template name="tk:EasySearchRef">
    <xsl:param name="Field"/>
    <xsl:for-each select="$Field/tk:EasySearch/RefValue">
      <xsl:value-of select="concat(', &quot;', @Field, '&quot;, ')"/>
      <xsl:variable name="RefFieldName" select="@RefField"/>
      <xsl:for-each select="$Field">
        <xsl:variable name="RefField" select="(following-sibling::tk:Field | preceding-sibling::tk:Field)[tk:FieldName=$RefFieldName]"/>
        <xsl:choose>
          <xsl:when test="$RefField/tk:EasySearch">"hd<xsl:value-of select="$RefField/tk:FieldName"/>"</xsl:when>
          <xsl:otherwise>"<xsl:value-of select="$RefField/tk:FieldName"/>"</xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </xsl:for-each>
  </xsl:template>
  <xsl:template name="tk:EasySearchRefBy">
    <xsl:param name="Field"/>
    <xsl:for-each select="$Field">
      <xsl:variable name="Temp" select="(following-sibling::tk:Field | preceding-sibling::tk:Field)[tk:EasySearch/RefValue/@RefField=$Field/tk:FieldName]"/>
      <xsl:if test="boolean($Temp)">
          function <xsl:value-of select="$Field/tk:FieldName"/>_change(){
        	  var eleObj = window.event.srcElement;
        	  var pos = GetRowID(eleObj);
            <xsl:for-each select="$Temp">
              document.all("<xsl:value-of select="tk:FieldName"/>", pos).value = "";</xsl:for-each>
          }
          </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template name="tk:EasySearchRefBy1">
    <xsl:param name="Field"/>
    <xsl:for-each select="$Field">
      <xsl:variable name="Temp" select="(following-sibling::tk:Field | preceding-sibling::tk:Field)[tk:EasySearch/RefValue/@RefField=$Field/tk:FieldName]"/>
      <xsl:if test="boolean($Temp)">1</xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
